removing spaces between 2 names
7stud
bbxx789_05ss at yahoo.com
Tue May 15 02:41:27 EDT 2007
On May 15, 12:14 am, Steven Howe <howe.ste... at gmail.com> wrote:
> saif.shak... at gmail.com wrote:
> > Hi,
> > Suppose i have a string stored in variable,how do i remove the
> > space between them,like if i have the name:
> > "USDT request" in a variable.i need "USDTrequest",without any space .
> > Thanks
>
> from string import replace
> st = 'abcd acdfg xtit'
> st.replace(' ','')
> 'abcdacdfgxtit'
>
> sph
>
> --
> HEX: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
The methods in the string module are deprecated. Skip the import and
use a string's built in replace() method instead:
s = "hello world"
result = s.replace(" ", "")
print result
More information about the Python-list
mailing list