I'm interested in implementing autocomplete in Python. For example, as the user types in a string, I'd like to show the subset of files on disk whose names start with that ... |
I have a CSV file which has the following format:
id,case1,case2,case3
123,null,X,Y
342,X,X,Y
456,null,null,null
789,null,null,X
above is the sample data that could be in that file. So for each line I need to know which of ... |
Usually when we search, we have a list of stories, we provide a search string, and expect back a list of results where the given search strings matches the story.
What i ... |
I have an application implementing incremental search. I have a catalog of unicode strings to be matched and match them to a given "key" string; a catalog string is a "hit" ... |
I have a sorted list of datetimes in text format. The format of each entry is '2009-09-10T12:00:00'.
I want to find the entry closest to a target. There are many ... |
In recent bash versions, I can do this:
$ string="Universe.World.Country.State.City.Street"
$ echo $string
Universe.World.Country.State.City.Street
$ newString="${string##*.}"
$ echo $newString
Street
Using Python, what is a succinct way to doing the same?
I am interested in the last substring after ... |
does anyone know which string matching algorithm is implemented in Python?
|
|
I have a string which has a version number. I want to read the version number from this code so I can compare it with other code I am using. I ... |
I have following:
temp = "aaaab123xyz@+"
lists = ["abc", "123.35", "xyz", "AND+"]
for list in lists
if re.match(list, temp, re.I):
print "The %s is within %s." % (list,temp)
The re.match is ... |
I have a string buffer of a huge text file. I have to search a given words/phrases in the string buffer. Whats the efficient way to do it ?
I tried ... |
I wrote my module in Python 3.1.2, but now I have to validate it for 2.6.4.
I'm not going to post all my code since it may cause confusion.
Brief explanation:
I'm writing ... |
I am trying to read from a file and match for a certain combination of strings. PFB my program:
def negative_verbs_features(filename):
# Open and read the file content
...
|
i have an string in which a word "LOCAL" is occurring many times. i used find() function for searching this word but it returns one more another word "Locally". How can ... |
main = ['123', '147', '159', '258', '369', '357', '456', '789']
match1 = 1374
match2 = 1892
here match1 has 1, 4 and 7 But main has '147' so it matches. match2 has 1,8,9,2 ... |
How can I build a python pyparsing structure that matches against a particular string ending. For example, suppose I want to find all words that end in 'ing'. The following does ... |
I downloaded the Wikipedia article titles file which contains the name of every Wikipedia article. I need to search for all the article titles that may be a possible match. ... |
I want to search and match a particular word in a text file.
with open('wordlist.txt', 'r') as searchfile:
for line in searchfile:
...
|
I have the following cython implementation of calculating the Damerau–Levenshtein distance of 2 strings, based on this Wikipedia article, but currently it is too slow for my needs. I ... |
The piece of code below takes a string (userstring) and searches all .txt and .log files in a given directory for a match. However, I've added two other variables (userStrHEX & ... |
I want to do a simple string match, searching from the -front- of the string. Are there easier ways to do this with maybe a builtin? (re seems like overkill)
def ...
|
I am using Python (pl/python, actually) to find, successively, a series of regex matches in a very large text object. This is working fine! Each match is a different result, and ... |
I need to match some string in a text file and want to get return the matching line. Let's say, I have string in 2D array as follows:
[['Shoo-Be-Doo-Be-Doo-Da-Day', 'Henry Cosby'],
['My ...
|
I have this xpath pattern:
tags = doc.xpath('/html/body//a[text() = "' + name.encode('utf8') + '"]/@href'
This returns the url of every -tag with name name as text in it. Is it possible to get ... |
I am new in python.I have data in a 2d- array in the following format.
array[0] ...
|
I am quite new in python.I want to match string in some lines of a file.Let's say,
I have string:
british 7
German 8
France ...
|
I am quite new in python & trying to do some new stuff.I have two list in a dictionary.Let's say,
List1: ...
|
I am getting trouble with the following matter.Let's say, I have some string in two list in a dictionary:
left ...
|
How to match exact string/word while searching a list. I have tried, but its not correct. below I have given the sample list, my code and the test results
list = ['Hi, ... |
Using: Python 2.4
Currently, I have a nested for loop that iterates over 2 lists and makes a match based on two elements that exists on both lists. Once a match ... |
Given are two python lists with strings in them (names of persons):
list_1 = ['J. Payne', 'George Bush', 'Billy Idol', 'M Stuart', 'Luc van den Bergen']
list_2 = ['John Payne', 'George W. Bush', ...
|
I'm trying to develop a python algorithm to check if a string could be an abbrevation for another word. For example
fck is a match for fc kopenhavn because it matches the ... |
I am trying to improve on a script which scans files for malicious code. We have a list of regex patterns in a file, one pattern on each line. ... |
I am trying to substring search
>>>str1 = 'this'
>>>str2 = 'researching this'
>>>str3 = 'researching this '
>>>"[^a-z]"+str1+"[^a-z]" in str2
False
>>>"[^a-z]"+str1+"[^a-z]" in str3
False
I wanted to True when looking in str3. what am I doing wrong?
... |
if your input is john why isn't the if statement kicking in????
studentname.txt
john 34
paul 37
poop 45
above is whats in studentname.txt
b=a
name = input('students name : ')
list1=[]
file=open('studentname.txt','r')
for (a) in file:
list1.append(a) ...
|
I can test whether a string is in a text file with python like the following:
if(pdfname in open(filename).read()):
//do something
But how I can I verify it? I want the ... |
Example:
1. names = ['James John', 'Robert David', 'Paul' ... the list has 5K items]
2.
3. text1 = 'I saw James today'
4. text2 = 'I saw James John today'
5. text3 = 'I ...
|
cords = []
for y in range(10):
for x in range(10):
cords.append((x, y))
print cords
print cords[11]
user_x=raw_input("X: ")
user_y=raw_input("Y: ")
xy = "("+user_x+", "+user_y+")"
print xy
if xy ...
|
Not from what you posted 1. "s" is not defined 2. there is at least one indentation error 3. there is a problem with at least one return 4. "z" had not been declared 5. "k" had not been declared 6. "char" had not been declared 7. what happens if '""' is not found If anyone falls for the old post-gobbledygook-to-get-someone-to-do-your-homework-for-you, ... |
|
I am new to python and could use some help with a fairly easy task. I would like to return all lines in a file that have the string '' to a list. Regards, -- Travis K. Toronto, Canada ------------------------------------------------------------ "She knows there's no success like failure And that failure's no success at all." -Bob Dylan- ------------------------------------------------------------ |
Hi everyone I'm using the re module to do regular expression searches of complicated strings. I need a way to extract matching parentheses in a string. For example, say my string is s = " x (a, (1,2,3), c, d, e ) , y ( (a,b,c) , (a,b,c) ) , z () ... " I want to be able to extract ... |
Code: Select all fruit= open("fruit.txt","rb") input_lines = inputfile.readlines() outputfile = open("outputfile.txt","wb") def f_fruit(): keys={} key_list = {} frequency={} line="" idx = 0 for line in fruit: key_list[idx] = line.lower().strip() idx += ... |
Hello all. I am using python 2.6.1 and I have a list of strings (36 letters long, no whitespace or other characters) in a file that is quite long. I want to cluster the strings in that file into groups by looping over the file, but also allow up to three of the characters in the strings to be mismatches. I ... |
|
command = raw_input("Command: ").strip() def func1(): print 'hello' def func2(): print 'goodbye' d = {"do 1":func1, "do 2":func2} if command in d: d[command]() else: print "unknown command" --output:-- Command: do 1 hello Command: do 2 goodbye Command: do 3 unknown command ... |
|