以下语句的 Fortran 等效项是什么

what is Fortran equivalent of the following statement

我想将格式化字符串分配给变量。例如,我会在 Python 中写入以下内容:

my_score = 100
line = "score = %d" % my_score 
print(line)

这将打印以下内容:

score = 100 

如何用 Fortran 编写相同的内容?

您的代码的直接实现类似于:

program test
implicit none

integer :: score
character(len=30) :: line

score = 100

write(line, '(A,I3)') "score = ", score

write(*,'(A)') line

end program test