Re: Help me split a string into elements

2021-09-04 Thread Neil
DFS wrote: > Typical cases: > lines = [('one\ntwo\nthree\n')] > print(str(lines[0]).splitlines()) > ['one', 'two', 'three'] > > lines = [('one two three\n')] > print(str(lines[0]).split()) > ['one',

Re: Help me split a string into elements

2021-09-04 Thread DFS
On 9/4/2021 5:55 PM, DFS wrote: Typical cases:  lines = [('one\ntwo\nthree\n')]  print(str(lines[0]).splitlines())  ['one', 'two', 'three']  lines = [('one two three\n')]  print(str(lines[0]).split())  ['one', 'two',

Help me split a string into elements

2021-09-04 Thread DFS
Typical cases: lines = [('one\ntwo\nthree\n')] print(str(lines[0]).splitlines()) ['one', 'two', 'three'] lines = [('one two three\n')] print(str(lines[0]).split()) ['one', 'two', 'three'] That's the resu

Re: The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-23 Thread Dan Stromberg
): > resultList = re.split(r'(\d*)', self.number) > if platform.python_version() == '3.6.8': > self.assertEqual(resultList,['', '123', '']) > > else: > self.assertEqual(resultList,['', '123'

Re: The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-23 Thread Thomas Jollans
g note in the docs for re.split: Changed in version 3.7: Added support of splitting on a pattern that could match an empty string. (your pattern can match an empty string, so I suppose it wasn't technically supported in 3.6?) -- Thomas I feel that this is clearly not in line with the

The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-22 Thread Andy AO
#x27;3.6.8': self.assertEqual(resultList,['', '123', '']) else: self.assertEqual(resultList,['', '123', '', '', '']) I feel that this is clearly not in line with the description of the function in

Re: Python Pandas split Date in day month year and hour

2020-08-19 Thread Tim Williams
On Wed, Aug 19, 2020 at 1:43 PM J Conrado wrote: > > > Hi, > > > I'm satarting using Pandas to read excel. I have a meteorological > synoptic data and I have for date: > > > 0 2017-11-01 00:00:00 > 1 2017-11-01 03:00:00 > 2 2017-11-01 06:00:00 > 3 2017-11-01 09:00:00 > 4 2017-11-01 12:0

RE: Python Pandas split Date in day month year and hour

2020-08-19 Thread Steve
what you want? FootNote: If money does not grow on trees, then why do banks have branches? -Original Message- From: Python-list On Behalf Of Brian Oney via Python-list Sent: Wednesday, August 19, 2020 2:01 PM To: python-list@python.org Subject: Re: Python Pandas split Date in day month

Re: Python Pandas split Date in day month year and hour

2020-08-19 Thread Skip Montanaro
> I would like know how can I get for this array the values for day, month > and hour: > > 2017-11-01 03:00:00 year = 2017 month = 11day = 1and > hour = 3 Pandas has a datetime type. You should probably be using it. It's been awhile (a year at least), but if your datetime co

Re: Python Pandas split Date in day month year and hour

2020-08-19 Thread Brian Oney via Python-list
On August 19, 2020 7:32:45 PM GMT+02:00, J Conrado wrote: > > >Hi, > > >I'm satarting using Pandas to read excel. I have a meteorological >synoptic data and I have for date: > > >0   2017-11-01 00:00:00 >1   2017-11-01 03:00:00 >2   2017-11-01 06:00:00 >3   2017-11-01 09:00:00 >4   2017-11-01

Python Pandas split Date in day month year and hour

2020-08-19 Thread J Conrado
Hi, I'm satarting using Pandas to read excel. I have a meteorological synoptic data and I have for date: 0   2017-11-01 00:00:00 1   2017-11-01 03:00:00 2   2017-11-01 06:00:00 3   2017-11-01 09:00:00 4   2017-11-01 12:00:00 ..  ... 229 2017-11-30 09:00:00 230 2017-11-30 12

Re: join and split with empty delimiter

2019-07-18 Thread MRAB
d by saying that two delimiters can't overlap, which is the usual rule. A reasonable interpretation of "not overlapping" might well exclude having more the one delimiter in the same place. The delimiters wouldn't be overlapping, they'd be adjacent, but it does seem reasonable

Re: join and split with empty delimiter

2019-07-18 Thread Ben Bacarisse
Danilo Coccia writes: > Il 18/07/2019 12:27, Ben Bacarisse ha scritto: >> Irv Kalb writes: >> >>> I have always thought that split and join are opposite functions. For >>> example, you can use a comma as a delimiter: >>> >>>>>> m

Re: join and split with empty delimiter

2019-07-18 Thread Danilo Coccia
Il 18/07/2019 12:27, Ben Bacarisse ha scritto: > Irv Kalb writes: > >> I have always thought that split and join are opposite functions. For >> example, you can use a comma as a delimiter: >> >>>>> myList = ['a', 'b', 'c', &#x

Re: join and split with empty delimiter

2019-07-18 Thread Richard Damon
ery special > delimiter because every string that gets joined using it includes it! > It's a wild version of ','.join(['a', 'b,c', 'd']).split(','). > > Of course str.split('') could be defined to work the way you expect, but

Re: join and split with empty delimiter

2019-07-18 Thread Ben Bacarisse
Irv Kalb writes: > I have always thought that split and join are opposite functions. For > example, you can use a comma as a delimiter: > >>>> myList = ['a', 'b', 'c', 'd', 'e'] >>>> myString = ','

Re: join and split with empty delimiter

2019-07-17 Thread MRAB
ature. +1. Not only that, it makes the language more symmetric/consistent. Put me down for +1 as well. Since the fix in the re module in Python 3.7, it can split on an empty string: >>> import re >>> re.split('', 'abc') ['', 'a',

Re: join and split with empty delimiter

2019-07-17 Thread Tim Daneliuk
On 7/17/19 4:24 PM, Chris Angelico wrote: > Agreed. There are a number of other languages where splitting on an > empty delimiter simply fractures the string into characters (I checked > Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful > feature. +1. Not only that, it makes the la

Re: join and split with empty delimiter

2019-07-17 Thread Chris Angelico
On Thu, Jul 18, 2019 at 7:06 AM Irv Kalb wrote: > If I join the list with the empty string as the delimiter: > > >>> myList = ['a', 'b', 'c', 'd'] > >>> myString = ''.join(myList) > >>> print(myString)

join and split with empty delimiter

2019-07-17 Thread Irv Kalb
I have always thought that split and join are opposite functions. For example, you can use a comma as a delimiter: >>> myList = ['a', 'b', 'c', 'd', 'e'] >>> myString = ','.join(myList) >>> print(myString

Re: pandas split and melt()

2019-06-26 Thread Peter Otten
es leading "#" >> return (c for c in consultants if c.strip("0123456789")) filters out the digit-only values. >> def explode_column(df, column, split): >> for _index, row in df.iterrows(): iterates over the rows of the data frame >>

Re: pandas split and melt()

2019-06-26 Thread Sayth Renshaw
onsultants(consultants): > consultants = (c.lstrip("#") for c in consultants.split(";")) > return (c for c in consultants if c.strip("0123456789")) > > def explode_column(df, column, split): > for _index, row in df.iterrows(): >

Re: pandas split and melt()

2019-06-26 Thread Peter Otten
ted_tasks.to_excel("filtered_logs.xlsx") > > This leaves me with a set of several columns. The main column of concern > for this example is a consultant > > Session date Consultant > 2019-06-21 11:15:00 WNEWSKI, Joan;#17226;#BALIN, Jock;#18139;#DUNE, > Colem;#1

Re: pandas split and melt()

2019-06-26 Thread Sayth Renshaw
Update. Option 1. - This annihilates all text in the column leaving nothing. completed_tasks['Consultant'] = completed_tasks['Consultant'].str.rstrip('.#123') Option 2. - returns unhashable series list. output = completed_tasks[completed_tasks['Consultant']].str.contains(r'/\b[^\d\W]+\b/g')

Re: pandas split and melt()

2019-06-25 Thread Sayth Renshaw
.html > > -- > Regards =dn I have managed to split but not filter the numbers. All other code being the same. ... completed_tasks = df.loc[(df['Completed'] == 'Yes') & (df['Motor/Property'] == 'Motor') & (df['Delivery Method'] ==

Re: pandas split and melt()

2019-06-25 Thread DL Neil
dateConsultant 2019-06-21 11:15:00 WNEWSKI, Joan;#17226;#BALIN, Jock;#18139;#DUNE, Colem;#17230; How can I split the consultant column, keep only names and drop the numbers and for every session date create a line with data and consultants name? NB. There are varied amounts of consultants so

pandas split and melt()

2019-06-25 Thread Sayth Renshaw
x27;] == 'Yes') & (df['Motor/Property'] == 'Motor') & (df['Delivery Method'] == 'Group Coaching')] print(completed_tasks.head(n=5)) completed_tasks.to_excel("filtered_logs.xlsx") This leaves me with a set of several columns. The main

Re: How to split a list type array into float array?

2019-05-21 Thread Ervin Hegedüs
> 27.1019 26.9223 26.7426 26.5630 26.3834 26.2037 26.0241 > 25.8445 25.6649 25.4852 25.3056 25.1260 24.9463 24.7667 24.5871 > 24.4075 24.2278 24.0482 -0.2616 -0.3215 -0.3813 -0.4412\n'] > > Can anyone help me split as a float array?

Re: How to split a list type array into float array?

2019-05-21 Thread Alister via Python-list
7.1019 26.9223 26.7426 26.5630 26.3834 26.2037 > 26.0241 25.8445 25.6649 25.4852 25.3056 25.1260 24.9463 > 24.7667 24.5871 24.4075 24.2278 24.0482 -0.2616 -0.3215 > -0.3813 -0.4412\n'] > > Can anyone help me split as a float array? >

How to split a list type array into float array?

2019-05-21 Thread Madhavan Bomidi
.4852 25.3056 25.1260 24.9463 24.7667 24.5871 24.4075 24.2278 24.0482 -0.2616 -0.3215 -0.3813 -0.4412\n'] Can anyone help me split as a float array? Thanks in advance -- https://mail.python.org/mailman/listinfo/python-list

How would you split project into 2 parts?

2018-04-24 Thread Viacheslav Kondratiuk
I need to split a project into 2 parts. To have one part as the main project and include the second one as a submodule. Those parts located at different parts of a project. I can see 2 ways how I can do that: 1. Use PyCharm Refactor->Move functionality. It works fine. It takes a module o

Re: logger.info / logger.error with logger.addHandler - how to split streams?

2016-12-28 Thread Alec Taylor
Thanks On Tue, Dec 27, 2016 at 2:57 AM, gst wrote: > Le lundi 26 décembre 2016 10:34:48 UTC-5, Alec Taylor a écrit : > > So I'm putting .info in one StringIO and .error in another StringIO. > > > > How do I stop them from both being put into both? > > > > Code: http://ideone.com/Nj6Asz > > > Hi,

Re: logger.info / logger.error with logger.addHandler - how to split streams?

2016-12-26 Thread gst
Le lundi 26 décembre 2016 10:34:48 UTC-5, Alec Taylor a écrit : > So I'm putting .info in one StringIO and .error in another StringIO. > > How do I stop them from both being put into both? > > Code: http://ideone.com/Nj6Asz Hi, it's doable with filter on the handlers: def exact_filter(level)

logger.info / logger.error with logger.addHandler - how to split streams?

2016-12-26 Thread Alec Taylor
So I'm putting .info in one StringIO and .error in another StringIO. How do I stop them from both being put into both? Code: http://ideone.com/Nj6Asz -- https://mail.python.org/mailman/listinfo/python-list

Re: csv into multiple columns using split function using python

2016-11-30 Thread Peter Otten
handa...@gmail.com wrote: > I am trying to split a specific column of csv into multiple column and > then appending the split values at the end of each row. > > `enter code here` > > import csv > fOpen1=open('Meta_D1.tx

Re: csv into multiple columns using split function using python

2016-11-29 Thread woooee
Add some print statements to see what is happening, especially after the for elem in mylist1: statement -- https://mail.python.org/mailman/listinfo/python-list

csv into multiple columns using split function using python

2016-11-29 Thread handar94
I am trying to split a specific column of csv into multiple column and then appending the split values at the end of each row. `enter code here` import csv fOpen1=open('Meta_D1.txt') reader=csv.reader(fOpen1) mylist=[elem[1].split(&#x

Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread Michael Torrie
On 10/16/2016 05:25 AM, k.adema...@gmail.com wrote: > Help me!, I would like to find split where the split sums are close > to each other? > > I have a list is > > test = [10,20,30,40,50,60,70,80,90,100] > > ​and I would like to find split where the split sums are

Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread breamoreboy
On Sunday, October 16, 2016 at 12:27:00 PM UTC+1, k.ade...@gmail.com wrote: > Help me!, I would like to find split where the split sums are close to each > other? > > I have a list is > > test = [10,20,30,40,50,60,70,80,90,100] > > ​and I would like to find split where

Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread k . ademarus
Help me!, I would like to find split where the split sums are close to each other? I have a list is test = [10,20,30,40,50,60,70,80,90,100] ​and I would like to find split where the split sums are close to each other by number of splits = 3 that ​all possible combinations and select the split

How to split a large nested for loop and distribute to hundreds of Amazon instance to run this kind of Python code?

2016-10-09 Thread Ho Yeung Lee
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5f0a9a51-a256-4671-a5fc-e213949e7204/how-to-refactor-3-nested-for-loop-into-smaller-for-loop-assume-each-of-them-independent?forum=csharpgeneral I wrote a algorithm to split for loop to generate maplesoft code for limited memory Assume I

Re: How to split value where is comma ?

2016-09-12 Thread alister
On Mon, 12 Sep 2016 14:30:32 +, Grant Edwards wrote: > On 2016-09-12, jmp wrote: >> On 09/11/2016 02:12 PM, Chris Angelico wrote: >>> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola >>> wrote: > I have worked places where they put stuff like this at the bottom of > emails sent to the

Re: How to split value where is comma ?

2016-09-12 Thread Grant Edwards
On 2016-09-12, jmp wrote: > On 09/11/2016 02:12 PM, Chris Angelico wrote: >> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola >> wrote: I have worked places where they put stuff like this at the bottom of emails sent to the person sitting next to them :) -raising entropy-ly yrs- Ro

Re: How to split value where is comma ?

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 12:00 AM, jmp wrote: > On 09/11/2016 02:12 PM, Chris Angelico wrote: >> >> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola >> wrote: I have worked places where they put stuff like this at the bottom of emails sent to the person sitting next to them :) -raisin

Re: How to split value where is comma ?

2016-09-12 Thread jmp
On 09/11/2016 02:12 PM, Chris Angelico wrote: On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola wrote: I have worked places where they put stuff like this at the bottom of emails sent to the person sitting next to them :) -raising entropy-ly yrs- Robin Becker Cannot do anything about it. It is

Re: How to split value where is comma ?

2016-09-11 Thread Andrea D'Amore
On 2016-09-08 09:27:20 +, Joaquin Alzola said: Cannot do anything about it. It is not on my MTA client and it is added by the company server :( If it depended on my I will remove it but I can not do that. This email is confidential and may be subject to privilege. If you are not the inten

Re: How to split value where is comma ?

2016-09-11 Thread Chris Angelico
On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola wrote: >>I have worked places where they put stuff like this at the bottom of emails >>sent to the person sitting next to them :) -raising entropy-ly yrs- Robin >>Becker > > Cannot do anything about it. It is not on my MTA client and it is added by

RE: How to split value where is comma ?

2016-09-11 Thread Joaquin Alzola
>I have worked places where they put stuff like this at the bottom of emails >sent to the person sitting next to them :) -raising entropy-ly yrs- Robin >Becker Cannot do anything about it. It is not on my MTA client and it is added by the company server :( If it depended on my I will remove i

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Steve D'Aprano
On Fri, 9 Sep 2016 08:13 am, Grant Edwards wrote: > After all, that boilerplate just makes the corporation look stupid and > incompetent. I wish that were true. Unfortunately, in the corporate world, it *doesn't* make them look stupid and incompetent. It makes them look conventional, careful,

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Grant Edwards
On 2016-09-08, Random832 wrote: > On Thu, Sep 8, 2016, at 18:13, Grant Edwards wrote: >> After all, that boilerplate just makes the corporation look stupid and >> incompetent. Any email that leaves the corporate network must be >> assumed to be visible to world+dog. Anybody who thinks differentl

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread D'Arcy J.M. Cain
On Thu, 08 Sep 2016 18:27:44 -0400 Random832 wrote: > If every lawyer in the world benefits from the interpretation that > this sort of notice is legally effective (since tomorrow it may be > they who accidentaly send privileged information), who will argue in > court that it's not? The reality is

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Steve D'Aprano
On Fri, 9 Sep 2016 04:59 pm, Rustom Mody wrote: > On Friday, September 9, 2016 at 2:37:48 AM UTC+5:30, Ben Finney wrote: >> Joaquin Alzola writes: >> > Added by the MTA of the company not by my client. >> >> Right. So, here are things you can do (that we cannot) about this: >> * Switch to a diffe

Re: How to split value where is comma ?

2016-09-09 Thread Chris Angelico
On Fri, Sep 9, 2016 at 4:20 PM, Rustom Mody wrote: > [Personal note: When I was a kid I thought that doctors removed fever by > sticking > a thermometer into one’s mouth. > Those who teach that programming needs to start with writing print statements > are the same except for not having the excus

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Rustom Mody
On Friday, September 9, 2016 at 2:37:48 AM UTC+5:30, Ben Finney wrote: > Joaquin Alzola writes: > > Added by the MTA of the company not by my client. > > Right. So, here are things you can do (that we cannot) about this: > * Switch to a different mail service, one which does not add that > nonse

Re: How to split value where is comma ?

2016-09-08 Thread Rustom Mody
On Friday, September 9, 2016 at 11:51:25 AM UTC+5:30, Rustom Mody wrote: > And if the original 'a' looked something like > >>> a="p:1,q:2,r:42" > > then you probably want something like: > > >>> {k:v for item in a.split(',') for k,v in [item.split(':')]} > {'q': '2', 'p': '1', 'r': '42'} > >>> W

Re: How to split value where is comma ?

2016-09-08 Thread Rustom Mody
On Friday, September 9, 2016 at 1:36:24 AM UTC+5:30, Larry Hudson wrote: > On 09/08/2016 07:57 AM, John Gordon wrote: > > In Joaquin Alzola writes: > > > >> Use the split > > > >> a.split(",") > >> for x in a: > >> print(x) >

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Jussi Piitulainen
Grant Edwards writes: > On 2016-09-08, Joaquin Alzola wrote: > >> Basically what all comes down is to complain. I wonder if in a >> company of 80,000 people I will manage to change that behaviour. > > Perhaps others have complained. If enough people complain, maybe > they'll do something. > > Aft

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Chris Angelico
On Fri, Sep 9, 2016 at 11:05 AM, Dennis Lee Bieber wrote: > I suspect, like the last two companies I've worked for -- corporate IT > policy is to block any access to non-corporate email systems. (Heck, my > current company is so paranoid that it adds "EXT:" to the subject of > incoming ema

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Random832
On Thu, Sep 8, 2016, at 18:13, Grant Edwards wrote: > After all, that boilerplate just makes the corporation look stupid and > incompetent. Any email that leaves the corporate network must be > assumed to be visible to world+dog. Anybody who thinks differently is > deluded and should not be allow

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Grant Edwards
On 2016-09-08, Joaquin Alzola wrote: > Basically what all comes down is to complain. I wonder if in a > company of 80,000 people I will manage to change that behaviour. Perhaps others have complained. If enough people complain, maybe they'll do something. After all, that boilerplate just makes

RE: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Lew Pitcher
On Thursday September 8 2016 17:17, in comp.lang.python, "Joaquin Alzola" wrote: > Hi Ben > > Thanks for the advice. > >> * Complain > > Basically what all comes down is to complain. I wonder if in a company of > 80,000 people I will manage to change that behaviour. Why don't you, at least, i

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Chris Angelico
On Fri, Sep 9, 2016 at 7:17 AM, Joaquin Alzola wrote: > Hi Ben > > Thanks for the advice. > >> * Complain > > Basically what all comes down is to complain. I wonder if in a company of > 80,000 people I will manage to change that behaviour. > This email is confidential and may be subject to privil

RE: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Joaquin Alzola
Hi Ben Thanks for the advice. > * Complain Basically what all comes down is to complain. I wonder if in a company of 80,000 people I will manage to change that behaviour. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or di

What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Ben Finney
Joaquin Alzola writes: > world? > > Cannot do anything. That's not true; you can do more than we. > Added by the MTA of the company not by my client. Right. So, here are things you can do (that we cannot) about this: * Complain, with reasoned explanation, to the management responsible for

RE: How to split value where is comma ?

2016-09-08 Thread Joaquin Alzola
https://mail.python.org/mailman/listinfo/python-list

Re: How to split value where is comma ?

2016-09-08 Thread Larry Hudson via Python-list
On 09/08/2016 07:57 AM, John Gordon wrote: In Joaquin Alzola writes: Use the split a.split(",") for x in a: print(x) This won't work. split() returns a list of split elements but the original string remains unchanged. You want something like this instead: ne

Re: How to split value where is comma ?

2016-09-08 Thread John Gordon
In Joaquin Alzola writes: > Use the split > a.split(",") > for x in a: > print(x) This won't work. split() returns a list of split elements but the original string remains unchanged. You want something like this instead: newlist = a.split(",")

Re: How to split value where is comma ?

2016-09-08 Thread Robin Becker
On 08/09/2016 03:54, D'Arcy J.M. Cain wrote: On Wed, 7 Sep 2016 16:04:40 + Joaquin Alzola wrote: .. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon

Re: How to split value where is comma ?

2016-09-07 Thread D'Arcy J.M. Cain
On Wed, 7 Sep 2016 16:04:40 + Joaquin Alzola wrote: > > where is a comma there should start new line ... How can i do it ? > > Use the split > > a.split(",") > for x in a: > print(x) Seems overly complex. print(a.replace(',', '\n'

RE: How to split value where is comma ?

2016-09-07 Thread Joaquin Alzola
> where is a comma there should start new line ... How can i do it ? Use the split a.split(",") for x in a: print(x) This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sende

Re: How to split value where is comma ?

2016-09-07 Thread Peter Pearson
On Wed, 7 Sep 2016 08:51:36 -0700 (PDT), Asad ur Rehman wrote: [snip] > sofia/external/1203632525,CS_EXECUTE, > Outbound Call, > 12036325259, > ,12036325259, > , > ,ACTIVE, > 9047125683, > 9047125683, > RECV, > 75a9d3ee-7511-11e6-a115-89a1f4981d2c, > vb-pmedia,7841c6c0-7511-11e6

How to split value where is comma ?

2016-09-07 Thread Asad ur Rehman
Here is my view.py import os.path import commands def call_report(request): a = commands.getstatusoutput('/usr/local/freeswitch/bin/fs_cli -x "show calls"') return HttpResponse(a) When i run this command it gives output which you can see... 0uuid,direction,created,created_epoch,nam

Re: A tough one: split on word length?

2016-05-16 Thread Ben Bacarisse
DFS writes: > Have: > '584323 Fri 13 May 2016 17:37:01 - (UTC) 584324 Fri 13 May 2016 > 13:44:40 -0400 584325 13 May 2016 17:45:25 GMT 584326 Fri 13 May 2016 > 13:47:28 -0400' > > Want: > [('584323', 'Fri 13 May 2016 17:37:01 - (UTC)'), > ('584324', 'Fri 13 May 2016 13:44:40 -0400'), >

Re: A tough one: split on word length?

2016-05-16 Thread Laurent Pointal
;), >('584324', 'Fri 13 May 2016 13:44:40 -0400'), >('584325', '13 May 2016 17:45:25 GMT'), >('584326', 'Fri 13 May 2016 13:47:28 -0400')] > > > Or maybe split() on space, then run through and add words of 6+ numb

Re: There has to be a better way to split this string!

2016-02-15 Thread Emile van Sebille
On 2/9/2016 10:50 PM, Cameron Simpson wrote: On 10Feb2016 07:34, srinivas devaki wrote: PS: trying to read mailing list when you are half woke, is a bad idea and trying reply to it is even bad idea. Regrettably, when one is half awake one is unable to realise what a bad idea it may be:-)

Re: There has to be a better way to split this string!

2016-02-09 Thread Cameron Simpson
On 10Feb2016 07:34, srinivas devaki wrote: On Feb 10, 2016 7:23 AM, "srinivas devaki" wrote: On Feb 10, 2016 6:56 AM, "Anthony Papillion" wrote: > I am using datetime.now() to create a unique version of a filename. > When the final file is named, it will look something like: > myfile-2015-0

Re: There has to be a better way to split this string!

2016-02-09 Thread srinivas devaki
On Feb 10, 2016 7:23 AM, "srinivas devaki" wrote: > > > On Feb 10, 2016 6:56 AM, "Anthony Papillion" wrote: > > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA512 > > > > Hello Everyone, > > > > I am using datetime.now() to create a unique version of a filename. > > When the final file is na

Re: [SOLVED] There has to be a better way to split this string!

2016-02-09 Thread Chris Kaynor
On Tue, Feb 9, 2016 at 5:58 PM, Anthony Papillion wrote: > > On 02/09/2016 07:47 PM, Ben Finney wrote: > > Anthony Papillion writes: > > > >> On 02/09/2016 07:26 PM, Anthony Papillion wrote: > >>> I am using datetime.now() to create a unique version of a filename. > >>> […] > >> > >> Found the so

Re: There has to be a better way to split this string!

2016-02-09 Thread Tim Chase
On 2016-02-09 19:26, Anthony Papillion wrote: > myfile-2015-02-09-19-08-45-4223 > > Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by > datetime.now() with "-"'s. I'm doing that using the following code > but it's freaking ugly and I KNOW there is a better way to do it. I > just

Re: [SOLVED] There has to be a better way to split this string!

2016-02-09 Thread Anthony Papillion
On 02/09/2016 07:47 PM, Ben Finney wrote: > Anthony Papillion writes: > >> On 02/09/2016 07:26 PM, Anthony Papillion wrote: >>> I am using datetime.now() to create a unique version of a filename. >>> […] >> >> Found the solution in strftime(). Exactly what I was looking for. > > For the task of

Re: There has to be a better way to split this string!

2016-02-09 Thread srinivas devaki
On Feb 10, 2016 6:56 AM, "Anthony Papillion" wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Hello Everyone, > > I am using datetime.now() to create a unique version of a filename. > When the final file is named, it will look something like: > > myfile-2015-02-09-19-08-45-4223 >

Re: [SOLVED] There has to be a better way to split this string!

2016-02-09 Thread Ben Finney
Anthony Papillion writes: > On 02/09/2016 07:26 PM, Anthony Papillion wrote: > > I am using datetime.now() to create a unique version of a filename. > > […] > > Found the solution in strftime(). Exactly what I was looking for. For the task of making a unique filename, you should also consider th

Re: There has to be a better way to split this string!

2016-02-09 Thread Oscar Benjamin
On 10 February 2016 at 01:26, Anthony Papillion wrote: > I am using datetime.now() to create a unique version of a filename. > When the final file is named, it will look something like: > > myfile-2015-02-09-19-08-45-4223 > > Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by > da

Re: [SOLVED] There has to be a better way to split this string!

2016-02-09 Thread Anthony Papillion
On 02/09/2016 07:26 PM, Anthony Papillion wrote: > Hello Everyone, > > I am using datetime.now() to create a unique version of a filename. > When the final file is named, it will look something like: > > myfile-2015-02-09-19-08-45-4223 > > Notice I'm replacing all of the "."'s, " "'s, and ":"'s

Re: There has to be a better way to split this string!

2016-02-09 Thread Chris Angelico
On Wed, Feb 10, 2016 at 12:26 PM, Anthony Papillion wrote: > I am using datetime.now() to create a unique version of a filename. First off, be aware that this won't make a unique file name. But if you're okay with that (deal with collisions somehow), then sure. > When the final file is named, it

There has to be a better way to split this string!

2016-02-09 Thread Anthony Papillion
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello Everyone, I am using datetime.now() to create a unique version of a filename. When the final file is named, it will look something like: myfile-2015-02-09-19-08-45-4223 Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by date

Re: Question about split method

2015-12-05 Thread Erik
On 05/12/15 20:27, Mark Lawrence wrote: On 05/12/2015 19:51, Robert wrote: On Saturday, December 5, 2015 at 2:29:28 PM UTC-5, Peter Pearson wrote: On Wed, 2 Dec 2015 14:44:30 -0600, Ian Kelly wrote: On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: [snip] ss0="1, 2, 4, 8, 16&q

Re: Question about split method

2015-12-05 Thread Mark Lawrence
On 05/12/2015 19:51, Robert wrote: On Saturday, December 5, 2015 at 2:29:28 PM UTC-5, Peter Pearson wrote: On Wed, 2 Dec 2015 14:44:30 -0600, Ian Kelly wrote: On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: [snip] ss0="1, 2, 4, 8, 16".split(", ") [snip] Try help(str.spl

Re: Question about split method

2015-12-05 Thread Robert
On Saturday, December 5, 2015 at 2:29:28 PM UTC-5, Peter Pearson wrote: > On Wed, 2 Dec 2015 14:44:30 -0600, Ian Kelly wrote: > > On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: > [snip] > >> ss0="1, 2, 4, 8, 16".split(", ") > [snip] > > Try help(

Re: Question about split method

2015-12-05 Thread Peter Pearson
On Wed, 2 Dec 2015 14:44:30 -0600, Ian Kelly wrote: > On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: [snip] >> ss0="1, 2, 4, 8, 16".split(", ") [snip] > Try help(str.split) Or if, like me, you can't remember the magic word "str", ask: help("

Re: Question about split method

2015-12-02 Thread Robert
On Wednesday, December 2, 2015 at 3:45:34 PM UTC-5, Ian wrote: > On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: > > Hi, > > > > I learn split method online. When I try to run the line with ss1 beginning, > > I don't understand why its output of ss1 and ss2. I hav

Re: Question about split method

2015-12-02 Thread Ian Kelly
On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: > Hi, > > I learn split method online. When I try to run the line with ss1 beginning, > I don't understand why its output of ss1 and ss2. I have check the help > about split. It looks like that it is a numpy method. > W

Question about split method

2015-12-02 Thread Robert
Hi, I learn split method online. When I try to run the line with ss1 beginning, I don't understand why its output of ss1 and ss2. I have check the help about split. It looks like that it is a numpy method. What is the split method parameter (within " ") for? Thanks, ...

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Rustom Mody
14 computedshopcartdb:103.5% 0 30|0 0|119m97m > > 1538 ComputedCartRS PRI 09:40:26 > > > > I'd like to split this line on multiple separators - in this case, > > consecutive whitespace, as well as the pipe symbol (|). > > Correct me if I'

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Joel Goldstick
103.5% 0 30|0 0|119m97m >> 1538 ComputedCartRS PRI 09:40:26 >> >> I'd like to split this line on multiple separators - in this case, >> consecutive whitespace, as well as the pipe symbol (|). > > Correct me if I'm misanalyzing t

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Chris Angelico
9:40:26 > > I'd like to split this line on multiple separators - in this case, > consecutive whitespace, as well as the pipe symbol (|). Correct me if I'm misanalyzing this, but it sounds to me like a simple transform-then-split would do the job: f.replace("|"," &

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread MRAB
On 2015-07-28 15:09, Victor Hooi wrote: On Tuesday, 28 July 2015 23:59:11 UTC+10, m wrote: W dniu 28.07.2015 o 15:55, Victor Hooi pisze: > I know the regex library also has a split, unfortunately, that does not collapse consecutive whitespace: > > In [19]: re.split(' |', f

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Oscar Benjamin
> > I'd like to split this line on multiple separators - in this case, > consecutive whitespace, as well as the pipe symbol (|). > Is this what you want: In [5]: def split(s): ...: elements = [] ...: for x in s.split(): # Split whitespace ...:

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Victor Hooi
On Tuesday, 28 July 2015 23:59:11 UTC+10, m wrote: > W dniu 28.07.2015 o 15:55, Victor Hooi pisze: > > I know the regex library also has a split, unfortunately, that does not > > collapse consecutive whitespace: > > > > In [19]: re.split(' |', f) > >

Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Victor Hooi
I have a line that looks like this: 14 *0330 *0 760 411|0 0 770g 1544g 117g 1414 computedshopcartdb:103.5% 0 30|0 0|119m97m 1538 ComputedCartRS PRI 09:40:26 I'd like to split this line on multiple separators - in this

  1   2   3   4   5   6   7   8   9   >