On May 15, 12:14 am, Steven Howe <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] 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 -- http://mail.python.org/mailman/listinfo/python-list