[Tutor] Printing with no newline :(
Prasad, Ramit
ramit.prasad at jpmorgan.com
Mon Nov 7 18:21:35 CET 2011
>> for line in file:
>> m = re.search(regexp, line)
>> if m:
>> letterGroup = m.group(0)
>> print(letterGroup[4])
>You can specify what to print after the argument(s) with the end keyword
>parameter:
>>>> items = 1, 2, 3
>>>> for item in items:
>... print(item, end=" ")
>...
Alternatively you could do the following.
letterGroups = []
for line in file:
m = re.search(regexp, line)
if m:
letterGroups.append( m.group(0)[4] )
print( ' '.join( letterGroups ) )
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
--
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Tutor
mailing list