Ask coding questions

← Back to all posts
Python User Variable
DeadWither (1)

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 (18930) [earned 5 cycles]
View Answer
Coder100 (18930)

yes, os.getenv("REPL_OWNER")

Coder100 (18930)

np mark as correct answer please @DeadWither

DeadWither (1)

Want cycles? Yeah did it @Coder100

Coder100 (18930)

lol no you didn't click the check mark @DeadWither

DeadWither (1)

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

OldWizard209 (1638)

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

import os

username = os.getenv("REPL_OWNER")