How to avoid creating a newline when using if-else in f-string expression
Advertisements Please see the below minimal example, printbbb = True print(f"""AAA {”’BBB”’ if printbbb else ”} CCC""") This prints AAA BBB CCC as desired, however, if I set printbbb to False, it prints AAA CCC How can I change the code so that it will print AAA CCC when printbbb is set to False? >Solution… Read More How to avoid creating a newline when using if-else in f-string expression