FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADOVBScript, SAP - ABAP

U

univbgp100

##FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO
VBScript, SAP - ABAP

FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO
VBScript, SAP - ABAP visit ebooks.univdatabase.com
 
A

Ahmed, Shakir

I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'

Desired output: '858215558'

I want to remove any spaces between string and any dashes between
strings. I could do it in access manually but want to do from python
script

Any help is highly appreciated.

sh
 
S

s0suk3

I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'

Desired output: '858215558'

I want to remove any spaces between string and any dashes between
strings. I could do it in access manually but want to do from python
script

Any help is highly appreciated.

string.replace('-', '').replace(' ', '')
 
A

Ahmed, Shakir

Thanks, works exactly what I needed.

-----Original Message-----
From: [email protected]
[mailto:p[email protected]] On Behalf Of
(e-mail address removed)
Sent: Tuesday, May 20, 2008 12:22 PM
To: (e-mail address removed)
Subject: Re: Removing Space and "-" from a string

I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'

Desired output: '858215558'

I want to remove any spaces between string and any dashes between
strings. I could do it in access manually but want to do from python
script

Any help is highly appreciated.

string.replace('-', '').replace(' ', '')
 
P

Paul Hankin

I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'

Desired output: '858215558'

I want to remove any spaces between string and any dashes between
strings. I could do it in access manually but want to do from python
script

'filter' returns a string if it's argument is a string, so works
nicely here.

def cleanup(s):
return filter(lambda x: x not in ' -', s)
 
T

Terry Reedy

I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'

Desired output: '858215558'

|def cleanup(s):
| return filter(lambda x: x not in ' -', s)

Or'858215558'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top