1
vote
2answers
20 views

Find and cut out a python substring

Here is what I'm trying to do: I have a long string: s = asdf23rlkasdfidsiwanttocutthisoutsadlkljasdfhvaildufhblkajsdhf I want to cut out the substring: iwanttocutthisout I will be iterating ...
0
votes
0answers
18 views

Getting a list of references using cscope and python

I am writing a Python script to edit a large C project. In this script I am using the subprocess module to call cscope's line oriented interface. This is an example of what I have been doing... ...
2
votes
1answer
52 views

python - fastest way to compare lists and search for term in list

Right now I'm writing some python code that needs to make list comparisons similar to the following: small_list = ["string"]*3 big_list = ["string"]*600000 big_list_excludes = ["string"]*600000 ...
0
votes
2answers
39 views

Trying to parse a string into a list in Python

So I have a string like so: pattern = "AAaa$$##" I want to parse it into a list so it outputs letter by letter, but I can't do pattern.split("") cause it gives an error. Like this pattern.split() ...
0
votes
1answer
61 views

Manipulating a string to create even chunks of three [on hold]

I am new to Python, and this is probably a very simple question, but I am having trouble figuring it out. I have some raw input that I need to convert. The input is a body of text such as ...
1
vote
4answers
48 views

How can I match a regex with a pattern and arbitary amount of times?

I current have a regular expression defined as follows: >>> import re >>> regex = re.compile("(\d+:)+(\d+)") >>> search_results = ...
0
votes
2answers
16 views

Dealing with string case and diacritics in python

I'm doing some text processing, and I need all the text to be converted to lowercase, BUT the text is french and I need to maintain all the diacritics, so that "È" would get converted to "è", etc. If ...
1
vote
1answer
40 views

using on other words length for formatted string [duplicate]

I want to have output like this: col1 col2 col3 col4 col5 row1 1 1 0 1 1 row2 1 0 0 1 0 row3 1 1 1 1 1 row4 1 0 0 0 ...
1
vote
2answers
41 views

How to get a word bounded between `word' with regex? python

Given the string (comparative of `good') changed for the better in health or fitness I need to extract the first string bounded between the slanted single quote and the single quote line = ...
0
votes
0answers
31 views

Matlab calling python, returning vector, str2num not working on returned vector

I am writing a piece of Matlab code in which it makes a number of calls to python. These calls are returning the data as a string. The problem I am having is converting the string to a number. Its not ...
0
votes
3answers
56 views

python split without creating blanks

I understand why it is important to create blanks using split thanks to this question, but sometimes it is necessary not to grab them. lets say you parsed some css and got the following strings: s1 ...
1
vote
3answers
53 views

Java: String formatting with placeholders

I am new to Java and am from Python. In Python we do string formatting like this: >>> x = 4 >>> y = 5 >>> print("{0} + {1} = {2}".format(x, y, x + y)) 4 + 5 = 9 ...
3
votes
3answers
61 views

Generate random string from regex character set

I assume there's some beautiful Pythonic way to do this, but I haven't quite figured it out yet. Basically I'm looking to create a testing module and would like a nice simple way for users to define a ...
2
votes
3answers
59 views

Python convert set to string and vice versa

Set to string. Obvious: >>> s = set([1,2,3]) >>> s set([1, 2, 3]) >>> str(s) 'set([1, 2, 3])' String to set? Maybe like this? >>> ...
-2
votes
1answer
37 views

String concatenation python

I have a file extension, I got it in this way: fileName, fileExtension = os.path.splitext(abspath) now I need my file extension to became a pattern, something like '*.fileExtension', included the ...

1 2 3 4 5 257
15 30 50 per page