У меня есть вопрос о кодировании в Python, я использую IDE Pycharm Community Edition.
У меня есть такой код
i = 0
str_1 = """public class Schedule_Boolean_Monday_""" + str(i) + """ {
public Schedule_Boolean_Monday_""" + str(i) + """_3(Context context){
this.mContext = context;
}
}"""
for i in range(3):
print(str_1)
И токовый выход выглядит следующим образом
public class Schedule_Boolean_Monday_0 {
public Schedule_Boolean_Monday_0_3(Context context){
this.mContext = context;
}
}
public class Schedule_Boolean_Monday_0 {
public Schedule_Boolean_Monday_0_3(Context context){
this.mContext = context;
}
}
public class Schedule_Boolean_Monday_0 {
public Schedule_Boolean_Monday_0_3(Context context){
this.mContext = context;
}
}
public class Schedule_Boolean_Monday_0
и public Schedule_Boolean_Monday_0_3(Context context)
не изменяются. Str (i) в String не увеличивается.
Я хотел бы получить такой вывод
public class Schedule_Boolean_Monday_0 {
public Schedule_Boolean_Monday_0_3(Context context){
this.mContext = context;
}
}
public class Schedule_Boolean_Monday_1 {
public Schedule_Boolean_Monday_1_3(Context context){
this.mContext = context;
}
}
public class Schedule_Boolean_Monday_2 {
public Schedule_Boolean_Monday_2_3(Context context){
this.mContext = context;
}
}
Возможно ли это увеличить целочисленное значение внутри строки ?? Я хотел бы услышать ваш совет.
Большое спасибо