Skip to content

Help using forward slashes inside f-strings #226

Closed Answered by ali-ramadhan
ali-ramadhan asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed looks like track_path is split with / as a separator so you cannot have / inside an f-string in track_path otherwise the splitting produces unterminated f-strings.

template_parts = template.split("/")

This might not be an issue for me since I'm planning on writing a plugin to handle disc and track numbering for me, but I'm wondering whether this is an intentional limitation or a bug.

This can also show up in cases where you want to divide a number, e.g. {f'track.sample_rate/1000'}kHz.

Replies: 1 comment 2 replies

Comment options

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

@ali-ramadhan
Comment options

Answer selected by ali-ramadhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants