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, 2019 in Python by Anirudh
• 2,080 points
135 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

How to transfer multiple lines in a file using python?

Hi@akhtar, I don't know it will help you ...READ MORE

answered Mar 31, 2020 in Python by MD
• 95,140 points
185 views
0 votes
1 answer

How to merge multiple json objects into a single json object using python

You may do like this but it ...READ MORE

answered Nov 22, 2020 in Python by Gitika
• 65,870 points
2,114 views
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
• 58,100 points
273 views
0 votes
2 answers

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

import os from optparse import OptionParser, Option class MyOption ...READ MORE

answered Jul 28, 2020 in Python by The real slim shady
3,248 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,780 points
503 views
0 votes
2 answers
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,969 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,504 views