Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Columnar output than can be copypasted into Excel Sheets?
Post Body

Hello there, I'm a Python beginner going through the Automate the Boring Stuff, already through the Automation Stuff.

I went through the Regular Expression Basics tutorial and thought of a code that along with identifying useful numbers/codes would output copyable columns. Found the columnar module and got into it.

I got this code, which is partly the one from the tutorial.

import re
from columnar import columnar

message=('Call me 415-555-1011 tomorrow, or at 415-555-9999 any other day. 378-123-4432 for reservations, 234-554-1234 for whatever. ')


phoneNumRegex= re.compile(r'\d\d\d-\d\d\d-\d\d\d\d')



print(phoneNumRegex.findall(message))

phoneNumbers=(phoneNumRegex.findall(message))
phoneNumbersList=[(phoneNumRegex.findall(message))]

headers = ['']
for i in phoneNumbers:
    headers.append('')


table = columnar(phoneNumbersList, headers, no_borders=True)
print(table)

# print(phoneNumbers)
# print(headers)
# print(len(phoneNumRegex.findall(message)))

The output I get is

 ['415-555-1011', '415-555-9999', '378-123-4432', '234-554-1234']



  415-555-1011  415-555-9999  378-123-4432  234-554-1234    

I would like for it to be displayed in rows in a single column instead of a column for each.

If along with that the output could be copypasted into Excel sheets (it fitting the rows instead of filling a single cell) this could be the basis of an applicable shortcut for work.

I suspect this is gonna explained further into the course, but I'm curious about asking it now.

Thanks.

Author
Account Strength
100%
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
33,938
Link Karma
1,603
Comment Karma
32,007
Profile updated: 1 week ago
Posts updated: 3 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago