473,395 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

removing spaces between 2 names

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

May 15 '07 #1
6 19329
sa**********@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

May 15 '07 #2
On May 15, 12:14 am, Steven Howe <howe.ste...@gmail.comwrote:
saif.shak...@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

May 15 '07 #3
On May 14, 11:00 pm, saif.shak...@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
s = "jk hij ght"
print "".join(s.split(" "))

May 15 '07 #4
Ant
On May 15, 7:41 am, 7stud <bbxx789_0...@yahoo.comwrote:
On May 15, 12:14 am, Steven Howe <howe.ste...@gmail.comwrote:
....
from string import replace
st = 'abcd acdfg xtit'
st.replace(' ','')
'abcdacdfgxtit'
....
The methods in the string module are deprecated. Skip the import and
use a string's built in replace() method instead:
This is true, but actually Steven *is* using the string's built in
replace method - the import isn't used in the code! Obviously the
import was a deliberate mistake designed to see if you were
awake... ;-)

--
Ant...

http://antroy.blogspot.com/
May 15 '07 #5
On Mon, 14 May 2007 23:14:23 -0700, Steven Howe wrote:
sa**********@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'
The line "from string import replace" is redundant.

--
Steven.
May 15 '07 #6
half.ital...@gmail.com wrote:
s = "jk hij ght"
print "".join(s.split(" "))
"".join(s.split()) is enough.
--
Roberto Bonvallet

May 15 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: hokiegal99 | last post by:
This script works as I expect, except for the last section. I want the last section to actually remove all spaces from the front and/or end of filenames. For example, a file that was named " test ...
3
by: larry | last post by:
Hi, I am a newbie to Internet programming. I have some questions about spacing in HTML control names and subsequently being able to access these input elements in JavaScript If you don't have...
2
by: Michael Bulatovich | last post by:
I have a simple db to keep track of work/time/projects etc. It has two fields (column) named "start time" and "end time" WITH THE SPACES. I'm trying to do some automation to a form associated with...
12
by: Magix | last post by:
Hi, Everytime I received a fix-length of string, let say 15 (the unused portion will filled with Spaces before receive), I want to remove the Spaces from END until I encounter a non-space char....
1
by: Mike in Paradise | last post by:
Is there a more effcient way of removing the spaces from the names for a Enumerated value that has several values when you split it)??? When you do a toString it puts ,<SPACE> between the entries...
3
by: Chris Sharman | last post by:
Are spaces allowed in names ? Eg <input name="my field" type="text" value="my data"> The html4 dtd seems to say this is cdata, which allows embedded single spaces, but say agents may trim...
40
by: raphfrk | last post by:
I have a program which reads in 3 filenames from the command line prog filename1 filename2 filename3 However, it doesn't work when one of the filenames has spaces in it (due to a directory...
12
by: Wayne | last post by:
I have been given the task of rewriting a database that seems as though it has been written by someone with a very basic understanding of Access. Many of the object names and field names in tables...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
2
code green
by: code green | last post by:
I am trying to write a simple function that will take a string containing an address line or business name and return it nicely formatted. By this I mean extra spaces removed and words capitalised....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.