Python Unicode Database

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

311 Views

The unicodedata module is used to access all of the Unicode characters using Unicode character databases. In this database, there are character properties of all characters. To use this modules, we need to import the unicodedata module in our code. import unicodedata Unicode Database Methods Some modules of the unicodedata module are described here. Module (unicodedata.lookup(name)) − This method is used to lookup the characters by name. When the name is valid, it should return the character. Otherwise it will raise the KeyError. Module (unicodedata.name(chr[, default]))− This method is used to return the name of the given ... Read More

Python program to find Union of two or more Lists?

Samual Sam
Updated on 30-Jul-2019 22:30:23

472 Views

Union operation means, we have to take all the elements from List1 and List 2 and all the elements store in another third list. List1::[1, 2, 3] List2::[4, 5, 6] List3::[1, 2, 3, 4, 5, 6] Algorithm Step 1: Input two lists. Step 2: for union operation we just use + operator. Example code # UNION OPERATION A=list() B=list() n=int(input("Enter the size of the List ::")) print("Enter the Element of first list::") for i in range(int(n)): k=int(input("")) A.append(k) print("Enter the Element of second list::") for i in range(int(n)): ... Read More

Python Internet String Preparation

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

225 Views

To identify different things in the internet, it is necessary to compare different identification for equality. The comparison procedure depends on the application domain. For an example, some things are case-insensitive etc. To check these kind of information stringprep is used. The RFC 3454 defines the procedure to prepare the Unicode strings before transmitting through the wire. After going through the preparation procedure, they have a certain normalized form. The RFC defines a set of tables; these tables can be combined into profiles. For an example there is a profile of stringprep is nameprep. In the nameprep, there are internationalized ... Read More

Python program to find Intersection of two lists?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

403 Views

Intersection operation means, we have to take all the common elements from List1 and List 2 and all the elements store in another third list. List1::[1, 2, 3] List2::[2, 3, 6] List3::[2, 3] Algorithm Step 1: input lists. Step 2: first traverse all the elements in the first list and check with the elements in the second list. Step 3: if the elements are matched then store in third list. Example code #Intersection of two lists def intertwolist(A, B): C = [i for i in A if i in B] ... Read More

Python GNU readline Interface

Chandu yadav
Updated on 30-Jul-2019 22:30:23

583 Views

The readline is UNIX specific module. It defines a number of functions to read and write history files in easier way from python interpreter. We can use this module directly or using the rlcompleter module. This module settings may affect the built-in input() method prompt and also the interactive prompt. For the MAC based system (on MAC OS X) this readline module can be implemented using the libedit library. The libedit configuration is different from GNU readline. To use this module, we need to import the readline module in the python code import readline Some methods of ... Read More

Check if a File is hidden in C#

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

591 Views

To retrieve the attributes of a file, use the FileAttributes Eumeration. It has various members like compressed, directory, hidden, etc. To check if a file is hidden, use the hidden member name. If the FileAttributes.hidden is set that would mean the file is hidden. Firstly, get the path to find the attributes. FileAttributes attributes = File.GetAttributes(path); If the following is set, that would mean the file is now hidden using the hidden member name. File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); Console.WriteLine("The {0} file is hidden.", path);

Second most repeated word in a sequence in Python?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

616 Views

The string is given, our task is to find out the second repeated word. Here we Counter(iterator) for creating dictionary which contains word as key and its frequency as value. Algorithm Step 1: Create user define list. Step 2: Then convert list into a dictionary. Step 2: Next get the values and sort them in descending order. Step 3: Then the second element is the second largest value. Step 4: Next again traverse whole dictionary and display key whose value is equal to second largest element. Example code # To print Second most repeated word in a ... Read More

Python Completion function for GNU readline

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

262 Views

Unix readline module has tab completion mechanism. To get these features, we have to use rlcompleter module. It can be used in python’s interactive mode. To use this module, we should import it using − import rlcompleter There is a class called Completer class − Method Completer.complete(text, state) This method is used to return the tab completion output. If there is a ‘.’ in the text, then it will try to get all related members of that command. When there is no dot ‘.’ it will just complete the text. Example Code import rlcompleter import sys ... Read More

Python Basic date and time types

George John
Updated on 30-Jul-2019 22:30:23

6K+ Views

To manipulate dates and times in the python there is a module called datetime. There are two types of date and time objects. The types are naïve and the aware. In the naïve object, there is no enough information to unambiguously locate this object from other date-time objects. In this approach it uses Coordinate Universal Time (UTC). In the aware type objects there are different information regarding algorithmic and political time adjustments. This type of objects is used to represent some specific time moments. To use this module, we should import it using − import datetime There are ... Read More

Sorting collection of String and StringBuffer in Java

Fendadis John
Updated on 30-Jul-2019 22:30:23

555 Views

In order to sort in Java as we know we can use either Comparable or Comparator interfaces in which we could also define our custom logic to sort.One of the approach to sort is to add the entity in TreeSet or TreeMap which would sort the entries as internally they also uses the comparable interface. Now String class in Java internally implements comparable interface so whenever we add string to a tree set or map it uses comparable logic of string class and sort the input entry strings.But String buffer do not have the implementation of comparable interface so ... Read More

Advertisements