Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reducing code length
#1
Hi everyone,

I'm new to python and I'm trying to reduce code length. Is there an efficient way to rewrite this simple code?
Thanks for the help!

Xav

def config_WOpick(lst):
   for k in lst:
       position=0
       if k.startswith('M1CW') or k.startswith('1CW') or k.startswith('CW'):
           for j in k:
               position+=1
               if j=='W':
                   print(k[position:])#insert the renaming action here later on
Reply


Messages In This Thread
Reducing code length - by xavier992 - Jul-21-2017, 09:12 PM
RE: Reducing code length - by Larz60+ - Jul-21-2017, 10:53 PM
RE: Reducing code length - by ichabod801 - Jul-21-2017, 10:58 PM
RE: Reducing code length - by snippsat - Jul-22-2017, 12:22 AM
RE: Reducing code length - by xavier992 - Jul-22-2017, 12:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 2,291 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Reducing JSON character count in Python for a Twitter Bot johnmitchell85 2 61,854 Apr-28-2021, 06:08 PM
Last Post: johnmitchell85
  fraction module: can you stop the reducing? qmfoam 1 2,466 Oct-10-2020, 06:10 PM
Last Post: bowlofred
  Need help reducing some code around a subprocess anistorian 4 3,024 Jun-12-2019, 03:32 PM
Last Post: snippsat
  output list reducing each time through loop 3Pinter 6 3,600 Mar-19-2019, 01:31 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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