Skip to content

Conditional chunk for python quarto docs #12026

Answered by jimjam-slam
boshek asked this question in Q&A
Discussion options

You must be logged in to vote

Unless you have a burning need for the conditional execution logic to not show up in your final output, I feel like it might just be easier to put that logic in the chunk itself:

```{python}
python import os

if os.getenv('VAR') == 'production':
    1+1
```

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@boshek
Comment options

@mcanouil
Comment options

mcanouil Feb 5, 2025
Collaborator

Answer selected by boshek
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@boshek
Comment options

@remlapmot
Comment options

@boshek
Comment options

@mcanouil
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
4 participants