•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,488 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,738 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 480 | Replies: 1
![]() |
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
any tips on how to get the program to display the first name in the final print strin
#1
Sep 12th, 2007
•
•
Join Date: Jun 2007
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 1
Re: any tips on how to get the program to display the first name in the final print s
#2
Sep 13th, 2007
>>> name=raw_input("Enter your name [first, last]")
Enter your name (first, last): FIRST, LAST
>>> List=name.split(', ') #name='FIRST, LAST'
>>> List
['FIRST', 'LAST']
>>>print "Hi, ", List[0] # print first>>> index=name.find(',') #First occurance of the comma
>>> first=name[0:index]
>>> first
'FIRST' Last edited by StrikerX11 : Sep 13th, 2007 at 12:53 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- final project (Visual Basic 4 / 5 / 6)
- Using OpenGL in Visual C++: Part I (Game Development)
- Pls help me (Java)
- Help with an Array GRading assignment (Java)
- Newby girl needing desparate help (Java)
- Simple Program will not exit gracefully (C++)
- Making a program that will display the result of a coin (C++)
- Help on assignment (C)
- Program to display ascending or descending triangle (C++)
- Help with program...Please...... (Java)
Other Threads in the Python Forum
- Previous Thread: help de-serialize XML-RPC string
- Next Thread: newbee: Simple Backend Python Script Question


Linear Mode