given:
my = 'my name is david'
i would like to make this into a list with 2 values
i would like the list to be:
mylist = ['my name is','david']
so i try using:
mylist = my.split(' ',1)
but i soon find it splits left to right which returns:
mylist = ['my','name is david']
to avoid having to use alot of other code, i am wondering if there is a way to make it split right...
Search Result
Collapse
12 results in 0.0050 seconds.
Keywords
Members
Tags
-
the str.split(sep,maxsplit) function
-
Split a line by whilespace or tabcharacter (\t)
Hi,
I have file in while following line are present
dir1 dir2 dir3 dir2 file1 file2
dir1_file1 dir1_file2\tdir 2_file1 dir2_file2\tdir 3_file1
...
...
reading a one line at a time from a file,
i'm using the function strtok_r() to split the each line with delimiter whilespace and '\t' character.
How can differentiate that 2 words are split by whitespace or... -
how do i split a joining multiple file
i've a problem to split a join multiple file.
here's my code to join a multiple file.
Code:import sys import os f = open("e:/Dev/1.jpg", "rb") g = open("e:/Dev/2.mp3", "rb") dataList = [] dataList.append(f.read()) dataList.append(g.read()) g.close() data = f.read() new = f.name f = open(new, 'wb') for data in dataList:
-
Crystal Reports Xi:Result of split function Display in multiple rows
Hello,
I am working on Crystal reports Xi.I am creating one formula using split function.I have to display the result in multiple rows.Example:
If address has Multiple Lines split it based on Space(any delimiter)then display in differrent rows for particular row.
Like that i have container Numbers concatenated with &.I have to display them in multiple rows one by one on record basis.
Here is my code:
... -
How to create report out of raw text file?
Hello,
I have a text file(tab delim) with data and I want to create report. Here is the content of text file:
HD John Smith j.smith@testmai l.com
CT service 1 5$
CT service2 1 6$
CT service3 4 7$
FT total 6 18$
HD Cindy Surname c.surname@testm ail.com
CT ... ... and etc.
HD- is report header, CT-report content(invoice items), FT-footer.
Now I'm splitting... -
How to display part of a line in a .txt file?
Hello,
I'm need of some help again.
I've got a Folder, in which there is a File.
In the File, there are two lines, and the data in the lines is seperated with a " // ".
Example:
There is a folder at location @"C:\ExampleFol der_ABCD\"
In the folder there is a file @"C:\ExampleFol der_ABCD\Exampl eFile_ABCD.txt"
In the file there are two lines:
Name_1... -
GeneticsJustin started a topic How do I split a text file without stripping the character I'm splitting at?in PythonHow do I split a text file without stripping the character I'm splitting at?
Hi everyone, I'm new to python and would like to split a FASTA (text) file into each different gene (separated by a ">"), randomly sample a certain number of the sequences, and print the result. I have the program almost working correctly, but for some reason text.split('>') strips all of the ">"s from the file. If there's some way I can either remove this strip or add back in the ">" character that would... -
Appalling performance after splitting database
Hi all, working in Access 2003 (using the Access 2000 file format).
I've been developing a moderate-sized database and have recently secured write permission for the network folder that is to be its permanent home. So after moving it there, I went to split the front and back ends so that I could test the links, distribute the front end, and begin training the administrators.
But it hasn't gone well.
Previously,... -
problem with "|" character while splitting text or string.
hi everybody,
I am having problem with "|" character while splitting text or string. but all other characters are working like (/ ; , - _).
Does "|" has a special property or does it related about its ASCII code?
my code is;
String delimeter="0";
int k = 0;
String[] list;
String line = buf.readLine();
while... -
Ormazd started a topic PERL script that prints out the file names and file sizes and determines the averagein PerlPERL script that prints out the file names and file sizes and determines the average
Hello,
I was wondering if anyone might be able to help me with a little PERL script? I'm very new and I have been given a task to write a simple Perl script that prints out the file names and file sizes and determines the average file size from the directory listing found in the "files.txt" file. In other words, I need to add up the size of all of the files listed in the text document and divide by the number of files listed.... -
Preg_split question
Hi,
i have a problem with a regular expression.
i want to split a string on character pipe | with preg_split php function.
The string is :
"foo|bar|'hello |world\'abc\'de f'|bye"
Result of split must be in an array :
foo
bar
hello|world'abc 'def
bye
Anyone have an idea ?
Thank you !!
bye -
splitting a file by a character
I got a multiline SQL file that I would like to split by ; and read into an array. However when I try to do
Code:my @array = split(";", <FH>);
Does anyone know how they would get the array of sql statements (and no new lines)?