Python Forum
Trying to extract Only the capitol letters from a string of text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to extract Only the capitol letters from a string of text
#1
Hello. I'm a bit of a newbie with Python, but I'm familiar enough with C++ and JavaScript that I can read code and have a good idea what it's supposed to do-I just suck at writing it off the top of my head. lol

I have multiple text messages I'm trying to sift through and for reasons I'm too lazy to explain--lost a bet, basically lol--I need to pull out only the Capitol Letters from large text strings.

I'm currently using Ubuntu Studio and using Terminal. Looking for something command line based that I can easily copy and past from. Can anyone point me in the right direction so I can get it up and working? Any help would be Greatly appreciated. Thank you. :-)
Reply
#2
show what you've tried so far, and where specifically you need help.
Reply
#3
If you can get your "large text strings" into a python string (read a file or simply cut/paste) you can just loop through it using the .isupper() string function to pluck out the capital letters.

You could also use a Linux script and a little RegEx (Regular Expressions) magic.
https://www.linuxnix.com/regular-expressions-linux-i/ The regex for uppercase is either [A-Z] or [:upper:].
"So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth!" - Tim the Enchanter
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string into 160-character chunks while adding text to each part iambobbiekings 9 9,611 Jan-27-2021, 08:15 AM
Last Post: iambobbiekings
  Reading a text until matched string and print it as a single line cananb 1 2,036 Nov-29-2020, 01:38 PM
Last Post: DPaul
  Appending to a text string syno7878 10 4,261 May-03-2020, 10:05 AM
Last Post: snippsat
  Using an integer to manipulate a string/text variable rexyboy2121 1 1,751 Apr-22-2020, 01:37 AM
Last Post: michael1789
Exclamation A function that takes a word and a string of forbidden letters pooyan89 5 4,681 Jun-12-2019, 09:44 PM
Last Post: nilamo
  Counting only letters in a string PraiseYAH 2 4,552 Jul-20-2018, 11:22 AM
Last Post: ichabod801
  program that search string in text file and do something alon30 1 3,256 Aug-04-2017, 08:10 AM
Last Post: buran
  How to find exact matching string from the text desul 5 4,113 Apr-17-2017, 04:31 PM
Last Post: nilamo
  How to extract two data types from a text file and store them as two separate lists banf 1 3,490 Jan-16-2017, 09:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020