The code i wrote just create a structure and print it in multiple lines How can create a string to contain all the Lines
import pyperclip
symbol = input('Symbol = ')
width = int(input('Width = '))
height = int(input('Height = '))
while height > 0:
print(symbol * width)
height = height - 1
print('\nCopy to Clipboard ?\nY For Yes\nN For No\n')
sel = input('')
if sel == 'Y':
pyperclip.copy('Here i want to copy the Structure')
elif sel == 'N':
print('Done')
You can use f-string and addition.
results = ""
while height > 0:
results += f"{symbol * width}\n"
height - = 1
print(results)
This should produce the same output as you code, but this time you have a unique string.