Skip to content
Sign upLog in
← Back to Community

Python User Variable

Profile icon
DeadWither

In python, there is the replit module.

Is there an in - built variable that is equal to the name of the replit user who is currently using the program?

Please tell me if there is an in built variable in Python like that

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
DeadWither
Comments
hotnewtop
Profile icon
Coder100

yes, os.getenv("REPL_OWNER")

Profile icon
DeadWither

@Coder100
Thanks very much

Profile icon
Coder100

np mark as correct answer please

@DeadWither

Profile icon
DeadWither

Want cycles? Yeah did it

@Coder100

Profile icon
Coder100

lol no you didn't click the check mark

@DeadWither

Profile icon
DeadWither

@Coder100
I also gave you 1 cycle per comment and 5 cycles for this answer! That is 8 cycles in total

Profile icon
OldWizard209

yep. you can get that by first importing the os module, and getting the user id like:

import os username = os.getenv("REPL_OWNER")
Profile icon
DeadWither

@OldWizard209
Thanks very much!