How to implement multiple try codes in a single block using Python?

0 votes

Hi all,

As per the title, I am facing a quick difficulty with respect to the code as shown below in the try block.

To keep it simple let me give you an example:

try:
    code x
    code y #if y fails, it should ignore, and go to z.
    code z #if z fails, go to pqr
    code pqr
except:
    pass

Is there a method I can use to achieve this? I am looking for some quick help, thanks!

Jan 14 in Python by Anirudh
• 2,060 points
27 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

“stub” __objclass__ in a Python class how to implement it?

You want to avoid interfering with this ...READ MORE

answered Sep 27, 2018 in Python by Priyaj
• 56,160 points
41 views
0 votes
1 answer

How can I rename multiple files in a certain directory using Python?

Use os.rename(src, dst) to rename or move a file ...READ MORE

answered Nov 23, 2018 in Python by ariaholic
• 7,320 points
89 views
0 votes
1 answer

How to correctly return an a dictionary as an output in zappier code using python?

David here, from the Zapier Platform team. ...READ MORE

answered Dec 3, 2018 in Python by charlie_brown
• 7,710 points
88 views
0 votes
1 answer
0 votes
1 answer

How to list only text files in a directory using python?

Well, you are using a complex way. ...READ MORE

answered Feb 3 in Python by Omkar
• 67,120 points
129 views
0 votes
1 answer

How to check if a substring is present in a string using Python?

To check if the substring exists in ...READ MORE

answered May 9 in Python by Sharan
31 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 129 views
+4 votes
6 answers