The console of the game "Civilization 7" is still very useful, and if you want to open the console, you need to enter the game file first and open C:\\Users\\[your username]\\AppData\\Local\\ Firaxis Games\\Sid Meier's Civilization VII, AppOptions.txt in AppOptions.
How to enable Civilization 7 console
When you open the console in the game, you can first open AppOptions.txt in C:\\Users\\[your username]\\AppData\\Local\\Firaxis Games\\Sid Meier's Civilization VII.
Then right-click to edit, add EnableDebugPanels 1, click Save and enter the game and press ~ to open the console. (In fact, it is to change; EnableDebugPanels -1 to EnableDebugPanels 1, the modification target is as shown in the figure below)