0
votes
1answer
16 views

Python Child/Parent classes, Child Class Returning String Twice?

Easy question and probably very obvious to one of you, but Im unsure of why this happends. So here are the three python files Ive made. Main Char class: class Character(): """ This is the ...
-6
votes
2answers
68 views

Finding and counting the frequency of known pairs of words in multiple files [closed]

Basically I need to count the number of word pairs in multiple files. I have a list of word pairs in a file called result.txt, which looks like: the of the by they is group their I want to check ...
3
votes
2answers
73 views

Python 3 Finding the last number in a string

How can I find the last number in any big string? For eg in the following string I want 47 as the output: 'tr bgcolor="aa77bb"td>font face="verdana"color="white" ...
0
votes
1answer
26 views

concatenate list by user input (string) and displaying the List

1) hi i want to create a program where the User can input strings and it add on as list. eg cmd : "hello " cmd : "every " cmd : "one " 'hello' 'every ' 'one' a = 0 while a < 3: b = ...
1
vote
1answer
25 views

Python bz2 - text vs. interactive console (data stream)

I was using bz2 earlier to try to decompress an input. The input that I wanted to decode was already in compressed format, so I decided to input the format into the interactive Python console: ...
1
vote
1answer
49 views

Does Python have a rope data structure?

In writing some Python code, I came upon a need for a string-like data structure that offers fast insertion into, access to, and deletion from arbitrary positions. The first data structure that came ...
1
vote
2answers
39 views

How to decrypt string froom textbuffer.get_text

i encode a char 'a' by pyDes and I want to decode it text = self.textbuffer.get_text(start, end) print text //',\xcc\x08\xe5\xa1\xa1fc' x = "{}".format(text) print x ...
1
vote
1answer
40 views

Replacing words in Python?

I'm trying to replace the letters in key with the letters in alpha (and vice versa): alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" key = "XPMGTDHLYONZBWEARKJUFSCIQV" I am trying to change a string to ...
3
votes
1answer
77 views

Python 3 Regex Last Match

How do I grab the 123 part of the following string using Python 3 regex module? ....XX (a lot of HTML characters)123 Here the ... Part denotes a long string consisting of HTML characters, words and ...
1
vote
3answers
34 views

trying to find text with wild card integers inside a string in a special format in Python

I have a piece of code that opens a file and iterates each line inside the formated text file there will be a piece of text like this: name.x00y00.whatever I searching for the x00y00 to see if ...
-2
votes
4answers
122 views

Counting the frequency of each word in a given text [closed]

I am looking for a python program that counts the frequencies of each word in a text, and output each word with its count and line numbers where it appears. We define a word as a contiguous sequence ...
1
vote
4answers
34 views

Python, Appending string on each item on the list

I have a code that concatenates a string 'lst' on each item of the list. i = 0 lim = len(lst) while i < lim: lst[i] = 'lst%s' % (lst[i]) i += 1 Is there a faster way ...
0
votes
2answers
29 views

Accessing list entries after spitting. Should be simple but I can't get this to work?

I'm opening a tab delimited file and for each line, I'm splitting elements into a list. I can access the first element in the list list[0], but trying to access subsequent elements isn't working. ...
3
votes
1answer
29 views

Keep last word on each line of text file, delete rest

I wrote this python script that keeps the first word on each line in a text file and then deletes the rest. How can I do the opposite, kind of, meaning keep the last word on each line in the file and ...
0
votes
2answers
43 views

Storing changes original?

bactuals is a list of strings. So is bpeaks. actuals=bactuals[1:] peaks=bpeaks[1:] If I look at bactuals now, I see that it is still a list of strings. If I do the following, though: ...

1 2 3 4 5 245
15 30 50 per page